/*题目：设计两个接口，分别为学生接口和教师接口，学生接口包含设置和获取学费的方法，
教师借口设置和获取教师工资的方法，定义一个研究生类，同时实现教师和学生接口，
研究生类包含的数据成员有姓名性别年龄学费和工资，创建一个研究生类对象，
如果工资减去学费不足两千，输出需要贷款信息。
 */
package demo;
//研究生类
class GraduateStudent implements IStudent,ITeacher{

    private String name;
    private String gender;//性别
    private  int age;
    private double learnMoney;//学费
    private double money;//工资

    public GraduateStudent(String name, String gender, int age) {
        this.name = name;
        this.gender = gender;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getLearnMoney() {
        return learnMoney;
    }

    public void setLearnMoney(double learnMoney) {
        this.learnMoney = learnMoney;
    }

    public double getMoney() {
        return money;
    }
    public void setMoney(double money){
        this.money=money;
    }

    public  void loans(){
        if(money-learnMoney<2000){
            System.out.println("需要贷款");
        }else{
            System.out.println("无需贷款");
        }

    }

    @Override
    public String toString() {
        return "GraduateStudent{" +
                "姓名='" + name + '\'' +
                ", 性别='" + gender + '\'' +
                ", 年龄=" + age +
                '}';
    }
}
public class Test {

    public static void main(String[] args) {
        GraduateStudent graduateStudent=new GraduateStudent("张三","男",18);
        System.out.println(graduateStudent.toString());
        graduateStudent.setLearnMoney(5000);
        graduateStudent.setMoney(6000);
        graduateStudent.loans();

    }
}
